package com.font.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.font.bean.Prescription;
import com.font.mapper.PrescriptionMapper;
import com.font.service.PrescriptionService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * (Prescription)表服务实现类
 *
 * @author makejava
 * @since 2023-07-13 10:24:26
 */
@Service("prescriptionService")
public class PrescriptionServiceImpl extends ServiceImpl<PrescriptionMapper, Prescription> implements PrescriptionService {


    @Override
    public List<Prescription> preList(String prescriptionName, String function, String prescriptionTypeKe, Integer currentPage, Integer pageSize) {

        return this.getBaseMapper().preList(prescriptionName,function,prescriptionTypeKe,currentPage,pageSize);
    }

    @Override
    public Map<String,Object> countMap() {
        LambdaQueryWrapper<Prescription> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        LambdaQueryWrapper<Prescription> lambdaQueryWrapper1 = new LambdaQueryWrapper<>();
        LambdaQueryWrapper<Prescription> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
        LambdaQueryWrapper<Prescription> lambdaQueryWrapper3 = new LambdaQueryWrapper<>();
        Integer gao = this.getBaseMapper().selectCount(lambdaQueryWrapper.eq(Prescription::getPrescriptionTypeKey, "77359a8f-7d91-456f-928a-c04d38e4e1f1"));
        Integer san = this.getBaseMapper().selectCount(lambdaQueryWrapper1.eq(Prescription::getPrescriptionTypeKey,"a2d88686-3077-4f5c-b94a-ffb1b3c7891b"));
        Integer zhu = this.getBaseMapper().selectCount(lambdaQueryWrapper2.eq(Prescription::getPrescriptionTypeKey, "29adb29c-585b-4e23-a253-7b5c6a20cb05"));
        Integer tang = this.getBaseMapper().selectCount(lambdaQueryWrapper3.eq(Prescription::getPrescriptionTypeKey, "5d1f2409-9668-4459-b686-5b0e9792d853"));
        HashMap<String, Object> map = new HashMap<>();
        map.put("gao",gao);
        map.put("san",san);
        map.put("zhu",zhu);
        map.put("tang",tang);
        return map;
    }
}
